/**
 * 
 */
package com.gmail.blackdog1987.carcare.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

import com.gmail.blackdog1987.carcare.BaseActivity;
import com.gmail.blackdog1987.carcare.R;
import com.gmail.blackdog1987.carcare.network.response.IResponse;
import com.gmail.blackdog1987.carcare.network.response.handler.IResponseHandler;
import com.gmail.blackdog1987.carcare.network.response.handler.OnResponseListener;

public class CarRentTypeActivity extends BaseActivity implements
		OnClickListener, OnResponseListener {
	private Context mContext;
	private Intent mIntent;

	protected void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_carrent_type);
		mContext = this;
		mIntent = new Intent(this, CarRentListActivity.class);
		initViews();
		initData(savedInstanceState);
		reg();
	}

	public void initViews() {}

	public void reg() {
		findViewById(R.id.carrent_type_1).setOnClickListener(this);
		findViewById(R.id.carrent_type_2).setOnClickListener(this);
		findViewById(R.id.carrent_type_3).setOnClickListener(this);
		findViewById(R.id.carrent_type_4).setOnClickListener(this);
		findViewById(R.id.carrent_type_5).setOnClickListener(this);
		findViewById(R.id.carrent_type_6).setOnClickListener(this);
		findViewById(R.id.carrent_type_7).setOnClickListener(this);
		findViewById(R.id.back).setOnClickListener(this);
	}

	public void initData(Bundle savedInstanceState) {}

	@Override
	public void onClick(View v) {

		switch (v.getId()) {
		case R.id.back:
			finish();
			break;
		case R.id.carrent_type_1:
			mIntent.putExtra("type", 1);
			startActivity(mIntent);
			break;
		case R.id.carrent_type_2:
			mIntent.putExtra("type", 2);
			startActivity(mIntent);
			break;
		case R.id.carrent_type_3:
			mIntent.putExtra("type", 3);
			startActivity(mIntent);
			break;
		case R.id.carrent_type_4:
			mIntent.putExtra("type", 4);
			startActivity(mIntent);
			break;
		case R.id.carrent_type_5:
			mIntent.putExtra("type", 5);
			startActivity(mIntent);
			break;
		case R.id.carrent_type_6:
			mIntent.putExtra("type", 6);
			startActivity(mIntent);
			break;
		case R.id.carrent_type_7:
			mIntent.putExtra("type", 7);
			startActivity(mIntent);
			break;
		default:
			break;
		}

	}

	@Override
	public void onResponse(IResponseHandler classz) {
		IResponse res = classz.getResponse();
//		if(res instanceof CarsaleCountResponse){
//			String text = MessageFormat.format(mChina.getText().toString(), ((CarsaleCountResponse) res).types, ((CarsaleCountResponse) res).cars);
//			mChina.setText(text);
//			String text2 = MessageFormat.format(mForign.getText().toString(), ((CarsaleCountResponse) res).forignTypes, ((CarsaleCountResponse) res).forignCars);
//			mForign.setText(text2);
//		}
	}

	@Override
	public void onError(IResponseHandler classz) {
		
	}
}
